<?php

/*
 * The folder structure:
 * 
 *       test_dir|
 *               |---- dir1|---- file1.txt
 *               |         |---- file2.txt  
 *               |         |---- file3.txt
 *               |
 *               |---- dir2
 *               |   
 *               |---- dir3|---- file2.txt
 * 
 */


/* case 4: 
 * 
 * Both source and destination  file paths are given.
 * The destination file already exists
 * and the $overwrite argument is set to false (the default value)
 * An exception is thrown
 */

use UC_PHP\FileSystem as FS;

try
{
    FS\FileSystem::copy_file(
        './test_dir/dir1/file2.txt', './test_dir/dir3/file2.txt');
}
catch (FS\FileSystemException $e)
{
    echo $e->getMessage();
}

if(is_file('./test_dir/dir3/file2.txt'))
{
    unlink('./test_dir/dir3/file2.txt');
}
